package com.gitee.magic.converter;

import com.gitee.magic.core.converter.AbstractConverterEditor;

/**
 * @author start
 */
public class IntegerConverterEditor extends AbstractConverterEditor<Integer> {

	public IntegerConverterEditor(Class<?> prototype) {
		super(prototype);
	}

	@Override
	public void restore(Object value) {
		if(value!=null) {
			setValue(Integer.parseInt(String.valueOf(value)));
		}
	}

	@Override
	public Integer converter() {
		if(getValue()==null) {
			return null;
		}
		return (Integer)getValue();
	}

}
